<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8" import="java.util.List"%>
<%@include file="/lib/common/basedir.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@include file="/lib/common/headerResource.html"%>
<!--sidebar-->
<link href="<%=basedir%>/lib/css/sidebar.css" rel="stylesheet">


<!-- bootstrap-select -->
<link
	href="<%=basedir%>/lib/util/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet">

<title>integral balance</title>

<style>
.content{
	margin-top: 3.8em;
}

.title {
	font-size: 1.3em;
}

.position {
	padding-left: 1.8em;
}

.line{
	margin-bottom: 3em;
}

.add{
	margin-top:0.5em;
}
</style>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<!--左侧导航-->
			<div class="col-sm-3 col-md-2 sidebar">
				<%@include file="../sidebar.jsp"%>
			</div>
			<!--右面板-->
			<div
				class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 rightPanel">
				<div class="col-md-10">
					<div class="row">
						<ul class="nav nav-tabs">
							<li role="presentation" class="active"><a href="<%=basedir%>/employee">有卡</a></li>
							<li role="presentation"><a href="<%=basedir%>/employee/sale/customer">无卡</a></li>
						</ul>
					</div>
					
					<form id="form" class="form-horizontal content" method="post" action="<%=basedir%>/employee/salePost">
						<div class="form-group line">
							<span class="title col-md-1">会员</span>
							<div class="col-md-3">
								<input type="text" name="membership" class="form-control" id="end"
									placeholder="会员">
							</div>
						</div>

						<div class="form-group line">
							<span class="title col-md-1">商品</span>
							<div class="col-md-4">
								<select id="lunchBegins" name="commodity" class="selectpicker"
								data-live-search="true" data-live-search-style="begins"
								title="商品">
							<%
									@SuppressWarnings("unchecked")
									List<String> commodities=(List<String>)request.getAttribute("commodities");
									String options="";
									if(commodities!=null){
										for(String s:commodities){
											options+="<option>"+s+"</option>";
										}
										}
								%>
								<%=options %>
							</select>
							</div>
							<span class="glyphicon glyphicon-plus  add" aria-hidden="true"
						role="button"></span>
						</div>
						
						<div class="form-group line save">
							<div class="col-md-2 ">
								<button type="submit" class="btn btn-default  btn-block submitBtn">确定</button>
							</div>
						</div>
						
						<%
						if (request.getAttribute("failedMsg") != null) {
					%>
					<div class="form-group" style="margin-top:-2.2em;">
						<div class="col-md-4 ">
							<div class="alert alert-danger alert-dismissible" role="alert"
								style="margin-top: 2em;">
								<button type="button" class="close" data-dismiss="alert"
									aria-label="Close">
									<span aria-hidden="true">&times;</span>
								</button>
								<%=request.getAttribute("failedMsg")%>
							</div>
						</div>
					</div>

					<%
						} else {
						}
					%>
					</form>

				</div>
			</div>
		</div>
	</div>

	<!-- jquery and bootstrap js -->
	<%@include file="/lib/common/footerResource.html"%>
	
	<script
		src="<%=basedir%>/lib/util/bootstrap-select/bootstrap-select.js"></script>
	
	<script>
	function addCommodity(){
		$('.save').before('<div class="form-group line"><span class="title col-md-1">商品</span><div class="col-md-4"><select id="lunchBegins" name="commodity" class="selectpicker" data-live-search="true" data-live-search-style="begins" title="商品">'+
				'<%=options %>'
				+'</select></div><span class="glyphicon glyphicon-plus add add0" aria-hidden="true" role="button"></span></div>');	
	}
	$(document).ready(function(){
		$("body").on("click", ".add", function(){
			$('.add').hide();
			addCommodity();
			$('.selectpicker').selectpicker();
		});
		});
	</script>

</body>
</html>